#include <am.h>
#include <klib.h>
#include <klib-macros.h>

#define IP_BASE_ADDR 0x10004000
#define REG_CTRL *((volatile uint32_t *)(IP_BASE_ADDR))
#define REG_PSCR *((volatile uint32_t *)(IP_BASE_ADDR + 4))
#define REG_CNT *((volatile uint32_t *)(IP_BASE_ADDR + 8))
#define REG_ALRM *((volatile uint32_t *)(IP_BASE_ADDR + 12))
#define REG_ISTA *((volatile uint32_t *)(IP_BASE_ADDR + 16))
#define REG_SSTA *((volatile uint32_t *)(IP_BASE_ADDR + 20))

int main(){
    putstr("rtc test\n");
    REG_CTRL = (uint32_t)1; // enter config mode
    REG_CNT = (uint32_t)666;
    REG_CTRL = (uint32_t)0x00000010;
    for(int i = 0; i < 6; ++i) {
        printf("REG_CNT: %d\n", REG_CNT);
    }
    return 0;
}
